package com.eryos.gwt.estate.client.view.impl;

import com.eryos.gwt.estate.client.view.ErrorView;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class ErrorViewImpl extends Composite implements ErrorView {

    private static ErrorViewImplUiBinder uiBinder = GWT.create(ErrorViewImplUiBinder.class);

    /** Presenter associated to the current View */
    private ErrorView.Presenter presenter;

    @UiTemplate("ErrorView.ui.xml")
    interface ErrorViewImplUiBinder extends UiBinder<Widget, ErrorViewImpl> {
    }

    @UiField
    Label errorMessage;

    /**
     * Default Constructor.
     */
    public ErrorViewImpl() {
        initUI();
    }

    /**
     * Initialization of UI.
     */
    protected void initUI() {
        initWidget(uiBinder.createAndBindUi(this));
    }

    @Override
    public void setPresenter(final ErrorView.Presenter presenter) {
        this.presenter = presenter;

        /************ Widget Presenter ************/
    }

    /**
     * 
     */
    @Override
    public void refreshView() {
        // TODO
    }

    @Override
    public void setException(Exception exc) {
        errorMessage.setText(exc.getMessage());
    }
}
